From c4eb14eb01d5d17541fb320a9c464132e5fb6904 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 28 Oct 2015 11:49:00 -0400 Subject: [PATCH] Revert "tooltip: Use an element name" This reverts commit efc8dc63e30d9d53df3cf336673f751fab437d2c. This change broke tooltip positioning in a way that I don't fully understand, so take it back for now. --- gtk/gtktooltip.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 8e8431a949..45e3e59f26 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -36,8 +36,6 @@ #include "gtkstylecontext.h" #include "gtkwindowprivate.h" #include "gtkaccessible.h" -#include "gtkcssnodeprivate.h" -#include "gtkwidgetprivate.h" #ifdef GDK_WINDOWING_WAYLAND @@ -59,7 +57,7 @@ * When you need a tooltip with a little more fancy contents, like adding an * image, or you want the tooltip to have different contents per #GtkTreeView * row or cell, you will have to do a little more work: - * + * * - Set the #GtkWidget:has-tooltip property to %TRUE, this will make GTK+ * monitor the widget for motion and related events which are needed to * determine when and where to show a tooltip. @@ -78,7 +76,7 @@ * In the probably rare case where you want to have even more control over the * tooltip that is about to be shown, you can set your own #GtkWindow which * will be used as tooltip window. This works as follows: - * + * * - Set #GtkWidget:has-tooltip and connect to #GtkWidget::query-tooltip as before. * Use gtk_widget_set_tooltip_window() to set a #GtkWindow created by you as * tooltip window. @@ -87,10 +85,6 @@ * gtk_widget_get_tooltip_window() and manipulate as you wish. The semantics of * the return value are exactly as before, return %TRUE to show the window, * %FALSE to not show it. - * - * # CSS nodes - * - * The toplevel used for tooltips has a single CSS node with name tooltip. */ @@ -175,12 +169,12 @@ gtk_tooltip_class_init (GtkTooltipClass *klass) static void gtk_tooltip_init (GtkTooltip *tooltip) { + GtkStyleContext *context; GtkWidget *window; GtkWidget *box; GtkWidget *image; GtkWidget *label; AtkObject *atk_obj; - GtkCssNode *cssnode; tooltip->timeout_id = 0; tooltip->browse_mode_timeout_id = 0; @@ -203,8 +197,8 @@ gtk_tooltip_init (GtkTooltip *tooltip) G_CALLBACK (gtk_tooltip_window_hide), tooltip); _gtk_window_request_csd (GTK_WINDOW (window)); - cssnode = gtk_widget_get_css_node (window); - gtk_css_node_set_name (cssnode, I_("tooltip")); + context = gtk_widget_get_style_context (window); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP); atk_obj = gtk_widget_get_accessible (window); if (GTK_IS_ACCESSIBLE (atk_obj)) -- 2.30.2